<?php
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH',
              realpath(dirname(dirname(__FILE__)) . '/application'));  
// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV',
              (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')
                                         : 'production'));
defined('CONFIG_PATH')
    || define('CONFIG_PATH',realpath(APPLICATION_PATH . '\configs'));

// Typically, you will also want to add your library/ directory
// to the include_path, particularly if it contains your ZF installed
set_include_path(implode(PATH_SEPARATOR, array(
    dirname(dirname(__FILE__)) . '/library',
    get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
require_once 'common/general.php';
require_once 'common/config.php';
require_once 'common/ajax.php';
require_once 'Zend/Loader/Autoloader.php';
require_once 'common/ajax.php';
require_once 'Zend/Loader/Autoloader.php';

require_once 'common/plugin.php';
$loader = Zend_Loader_Autoloader::getInstance();
$controller = Zend_Controller_Front::getInstance();
$controller->throwExceptions(true);
$controller->setControllerDirectory(APPLICATION_PATH.'/modules/default/controllers');
$environment = APPLICATION_ENV;
$options = CONFIG_PATH . '\application.ini';
$config = new Zend_Config_Ini(CONFIG_PATH . '\config.ini','general');
$auth_config = new Zend_Config_Ini(CONFIG_PATH.'\auth.ini','general');
$registry = Zend_Registry::getInstance();
$registry->set('auth_config',$auth_config);
$registry->set('config',$config);

$auth = Zend_Auth::getInstance();
Zend_Registry::set('auth', $auth);
require_once APPLICATION_PATH .'/modules/auth/controllers/Auth_Plugin_Controller.php';
$controller->registerPlugin(new Auth_Plugin_Controller($auth));

$application = new Zend_Application($environment, $options);
$application->bootstrap()->run();

